<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>按键长按事件 | epg-focus-vue</title>
    <meta name="description" content="主要应用于电视端焦点交互">
    <meta name="generator" content="VuePress 1.4.0">
    <meta name="theme-color" content="#3eaf7c">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
    
    <link rel="preload" href="/epg-focus/assets/css/0.styles.33941019.css" as="style"><link rel="preload" href="/epg-focus/assets/js/app.b31e66c6.js" as="script"><link rel="preload" href="/epg-focus/assets/js/2.20e6004e.js" as="script"><link rel="preload" href="/epg-focus/assets/js/21.b87d0d78.js" as="script"><link rel="prefetch" href="/epg-focus/assets/js/10.2514fb4c.js"><link rel="prefetch" href="/epg-focus/assets/js/11.793ea926.js"><link rel="prefetch" href="/epg-focus/assets/js/12.01e4e231.js"><link rel="prefetch" href="/epg-focus/assets/js/13.1423ccd0.js"><link rel="prefetch" href="/epg-focus/assets/js/14.115308bc.js"><link rel="prefetch" href="/epg-focus/assets/js/15.8399aeea.js"><link rel="prefetch" href="/epg-focus/assets/js/16.bd815638.js"><link rel="prefetch" href="/epg-focus/assets/js/17.dd77a29f.js"><link rel="prefetch" href="/epg-focus/assets/js/18.ae87f8b0.js"><link rel="prefetch" href="/epg-focus/assets/js/19.c6e425a9.js"><link rel="prefetch" href="/epg-focus/assets/js/20.5dd0cf52.js"><link rel="prefetch" href="/epg-focus/assets/js/22.5709ae7e.js"><link rel="prefetch" href="/epg-focus/assets/js/23.1c381a02.js"><link rel="prefetch" href="/epg-focus/assets/js/24.a133fc1f.js"><link rel="prefetch" href="/epg-focus/assets/js/25.d262c8d0.js"><link rel="prefetch" href="/epg-focus/assets/js/26.825a6650.js"><link rel="prefetch" href="/epg-focus/assets/js/27.57eb15d3.js"><link rel="prefetch" href="/epg-focus/assets/js/28.5b056900.js"><link rel="prefetch" href="/epg-focus/assets/js/3.7cc2bdd4.js"><link rel="prefetch" href="/epg-focus/assets/js/4.82f74d64.js"><link rel="prefetch" href="/epg-focus/assets/js/5.fe38ea94.js"><link rel="prefetch" href="/epg-focus/assets/js/6.0d7ca19c.js"><link rel="prefetch" href="/epg-focus/assets/js/7.4478646a.js"><link rel="prefetch" href="/epg-focus/assets/js/8.0d360ba2.js"><link rel="prefetch" href="/epg-focus/assets/js/9.40007ddf.js">
    <link rel="stylesheet" href="/epg-focus/assets/css/0.styles.33941019.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/epg-focus/" class="home-link router-link-active"><!----> <span class="site-name">epg-focus-vue</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/epg-focus/guide/" class="nav-link">
  引导
</a></div><div class="nav-item"><a href="/epg-focus/v1/" class="nav-link">
  v1
</a></div><div class="nav-item"><a href="/epg-focus/v2/" class="nav-link router-link-active">
  v2
</a></div><div class="nav-item"><a href="/epg-focus/v3/" class="nav-link">
  v3
</a></div><div class="nav-item"><a href="https://gitee.com/wyzhgx/focus-vue" target="_blank" rel="noopener noreferrer" class="nav-link external">
  gitee
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div><div class="nav-item"><a href="https://www.npmjs.com/package/epg-focus-vue" target="_blank" rel="noopener noreferrer" class="nav-link external">
  npm
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/epg-focus/guide/" class="nav-link">
  引导
</a></div><div class="nav-item"><a href="/epg-focus/v1/" class="nav-link">
  v1
</a></div><div class="nav-item"><a href="/epg-focus/v2/" class="nav-link router-link-active">
  v2
</a></div><div class="nav-item"><a href="/epg-focus/v3/" class="nav-link">
  v3
</a></div><div class="nav-item"><a href="https://gitee.com/wyzhgx/focus-vue" target="_blank" rel="noopener noreferrer" class="nav-link external">
  gitee
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div><div class="nav-item"><a href="https://www.npmjs.com/package/epg-focus-vue" target="_blank" rel="noopener noreferrer" class="nav-link external">
  npm
  <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></div> <!----></nav>  <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>v2.x开发文档</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/epg-focus/v2/" class="sidebar-link">全局配置</a></li><li><a href="/epg-focus/v2/api.html" class="sidebar-link">全局 API</a></li><li><a href="/epg-focus/v2/event.html" class="sidebar-link">按键事件</a></li><li><a href="/epg-focus/v2/long-event.html" class="active sidebar-link">按键长按事件</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/epg-focus/v2/long-event.html#keylongleft" class="sidebar-link">keyLongLeft</a></li><li class="sidebar-sub-header"><a href="/epg-focus/v2/long-event.html#keylongup" class="sidebar-link">keyLongUp</a></li><li class="sidebar-sub-header"><a href="/epg-focus/v2/long-event.html#keylongright" class="sidebar-link">keyLongRight</a></li><li class="sidebar-sub-header"><a href="/epg-focus/v2/long-event.html#keylongdown" class="sidebar-link">keyLongDown</a></li><li class="sidebar-sub-header"><a href="/epg-focus/v2/long-event.html#keylongenter" class="sidebar-link">keyLongEnter</a></li><li class="sidebar-sub-header"><a href="/epg-focus/v2/long-event.html#keylongback" class="sidebar-link">keyLongBack</a></li><li class="sidebar-sub-header"><a href="/epg-focus/v2/long-event.html#keylongnumber" class="sidebar-link">keyLongNumber</a></li><li class="sidebar-sub-header"><a href="/epg-focus/v2/long-event.html#keylongfoward" class="sidebar-link">keyLongFoward</a></li><li class="sidebar-sub-header"><a href="/epg-focus/v2/long-event.html#keylongrewind" class="sidebar-link">keyLongRewind</a></li><li class="sidebar-sub-header"><a href="/epg-focus/v2/long-event.html#keylongplay" class="sidebar-link">keyLongPlay</a></li><li class="sidebar-sub-header"><a href="/epg-focus/v2/long-event.html#keylongpause" class="sidebar-link">keyLongPause</a></li><li class="sidebar-sub-header"><a href="/epg-focus/v2/long-event.html#keylongstop" class="sidebar-link">keyLongStop</a></li><li class="sidebar-sub-header"><a href="/epg-focus/v2/long-event.html#keylongdelete" class="sidebar-link">keyLongDelete</a></li></ul></li><li><a href="/epg-focus/v2/items.html" class="sidebar-link">items</a></li><li><a href="/epg-focus/v2/group.html" class="sidebar-link">group</a></li><li><a href="/epg-focus/v2/keep-alive.html" class="sidebar-link">keepAlive 应用方案</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="按键长按事件"><a href="#按键长按事件" class="header-anchor">#</a> 按键长按事件</h1> <p>指定按键长按超过<code>650ms</code>松开触发长按事件。</p> <h2 id="keylongleft"><a href="#keylongleft" class="header-anchor">#</a> keyLongLeft</h2> <ul><li><strong>Type</strong>：<code>Function</code></li> <li><strong>简介</strong>：按键左，默认对应键值：<code>3, 37</code></li> <li><strong>应用</strong>：</li></ul> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">this</span><span class="token punctuation">.</span>$Focus<span class="token punctuation">.</span><span class="token function-variable function">keyLongLeft</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre></div><h2 id="keylongup"><a href="#keylongup" class="header-anchor">#</a> keyLongUp</h2> <ul><li><strong>Type</strong>：<code>Function</code></li> <li><strong>简介</strong>：按键上，默认对应键值：<code>1, 38, 61</code></li> <li><strong>应用</strong>：</li></ul> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">this</span><span class="token punctuation">.</span>$Focus<span class="token punctuation">.</span><span class="token function-variable function">keyLongUp</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre></div><h2 id="keylongright"><a href="#keylongright" class="header-anchor">#</a> keyLongRight</h2> <ul><li><strong>Type</strong>：<code>Function</code></li> <li><strong>简介</strong>：按键右，默认对应键值：<code>4, 39</code></li> <li><strong>应用</strong>：</li></ul> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">this</span><span class="token punctuation">.</span>$Focus<span class="token punctuation">.</span><span class="token function-variable function">keyLongRight</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre></div><h2 id="keylongdown"><a href="#keylongdown" class="header-anchor">#</a> keyLongDown</h2> <ul><li><strong>Type</strong>：<code>Function</code></li> <li><strong>简介</strong>：按键下，默认对应键值：<code>2, 40, 77</code></li> <li><strong>应用</strong>：</li></ul> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">this</span><span class="token punctuation">.</span>$Focus<span class="token punctuation">.</span><span class="token function-variable function">keyLongDown</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre></div><h2 id="keylongenter"><a href="#keylongenter" class="header-anchor">#</a> keyLongEnter</h2> <ul><li><strong>Type</strong>：<code>Function</code></li> <li><strong>简介</strong>：确认键，默认对应键值：<code>13</code></li> <li><strong>应用</strong>：</li></ul> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">this</span><span class="token punctuation">.</span>$Focus<span class="token punctuation">.</span><span class="token function-variable function">keyLongEnter</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre></div><h2 id="keylongback"><a href="#keylongback" class="header-anchor">#</a> keyLongBack</h2> <ul><li><strong>Type</strong>：<code>Function</code></li> <li><strong>简介</strong>：返回键，默认对应键值：<code>8, 22, 27, 340, 461, 10009</code></li> <li><strong>应用</strong>：</li></ul> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">this</span><span class="token punctuation">.</span>$Focus<span class="token punctuation">.</span><span class="token function-variable function">keyLongBack</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre></div><h2 id="keylongnumber"><a href="#keylongnumber" class="header-anchor">#</a> keyLongNumber</h2> <ul><li><strong>Type</strong>：<code>Function</code></li> <li><strong>简介</strong>：数字键，默认对应键值：<code>48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105</code></li> <li><strong>应用</strong>：</li></ul> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">this</span><span class="token punctuation">.</span>$Focus<span class="token punctuation">.</span><span class="token function-variable function">keyLongNumber</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre></div><h2 id="keylongfoward"><a href="#keylongfoward" class="header-anchor">#</a> keyLongFoward</h2> <ul><li><strong>Type</strong>：<code>Function</code></li> <li><strong>简介</strong>：快进键，默认对应键值：<code>70, 417</code></li> <li><strong>应用</strong>：</li></ul> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">this</span><span class="token punctuation">.</span>$Focus<span class="token punctuation">.</span><span class="token function-variable function">keyLongFoward</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre></div><h2 id="keylongrewind"><a href="#keylongrewind" class="header-anchor">#</a> keyLongRewind</h2> <ul><li><strong>Type</strong>：<code>Function</code></li> <li><strong>简介</strong>：快退键，默认对应键值：<code>82, 412</code></li> <li><strong>应用</strong>：</li></ul> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">this</span><span class="token punctuation">.</span>$Focus<span class="token punctuation">.</span><span class="token function-variable function">keyLongRewind</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre></div><h2 id="keylongplay"><a href="#keylongplay" class="header-anchor">#</a> keyLongPlay</h2> <ul><li><strong>Type</strong>：<code>Function</code></li> <li><strong>简介</strong>：播放键，默认对应键值：<code>80, 415</code></li> <li><strong>应用</strong>：</li></ul> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">this</span><span class="token punctuation">.</span>$Focus<span class="token punctuation">.</span><span class="token function-variable function">keyLongPlay</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre></div><h2 id="keylongpause"><a href="#keylongpause" class="header-anchor">#</a> keyLongPause</h2> <ul><li><strong>Type</strong>：<code>Function</code></li> <li><strong>简介</strong>：暂停键，默认对应键值：<code>81, 19</code></li> <li><strong>应用</strong>：</li></ul> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">this</span><span class="token punctuation">.</span>$Focus<span class="token punctuation">.</span><span class="token function-variable function">keyLongPause</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre></div><h2 id="keylongstop"><a href="#keylongstop" class="header-anchor">#</a> keyLongStop</h2> <ul><li><strong>Type</strong>：<code>Function</code></li> <li><strong>简介</strong>：停止键，默认对应键值：<code>83, 413</code></li> <li><strong>应用</strong>：</li></ul> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">this</span><span class="token punctuation">.</span>$Focus<span class="token punctuation">.</span><span class="token function-variable function">keyLongStop</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre></div><h2 id="keylongdelete"><a href="#keylongdelete" class="header-anchor">#</a> keyLongDelete</h2> <ul><li><strong>Type</strong>：<code>Function</code></li> <li><strong>简介</strong>：删除键，默认对应键值：<code>46, 67</code></li> <li><strong>应用</strong>：</li></ul> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">this</span><span class="token punctuation">.</span>$Focus<span class="token punctuation">.</span><span class="token function-variable function">keyLongDelete</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre></div></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><span class="prev">
      ←
      <a href="/epg-focus/v2/event.html" class="prev">
        按键事件
      </a></span> <span class="next"><a href="/epg-focus/v2/items.html">
        items
      </a>
      →
    </span></p></div> </main></div><div class="global-ui"><!----></div></div>
    <script src="/epg-focus/assets/js/app.b31e66c6.js" defer></script><script src="/epg-focus/assets/js/2.20e6004e.js" defer></script><script src="/epg-focus/assets/js/21.b87d0d78.js" defer></script>
  </body>
</html>
